﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BaseStatisticControlLibrary.ViewModels;

namespace BaseStatisticControlLibrary.Views
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    [Export(typeof(OverallStatisticsView))]
    public partial class OverallStatisticsView : UserControl
    {

        OverallStatisticsViewModel VM { get { return (OverallStatisticsViewModel)DataContext; } }

        public OverallStatisticsView()
        {
            InitializeComponent();
            this.Loaded += OverallStatisticsView_Loaded;
            this.Unloaded += OverallStatisticsView_Unloaded;
            //Activation here
        }

        void OverallStatisticsView_Unloaded(object sender, RoutedEventArgs e)
        {
            if (VM != null) VM.Deactivate();
        }

        void OverallStatisticsView_Loaded(object sender, RoutedEventArgs e)
        {
            if (VM != null) VM.Activate();    
        }


    }
}
